//
//  MenuFootView.m
//  HTP
//
//  Created by admin on 15/10/31.
//  Copyright © 2015年 nit. All rights reserved.
//

#import "MenuFootView.h"
#define MENUFOOTIMAGEWIDTH 25
@interface MenuFootView()
@property (nonatomic,retain) UIImageView *setImg;
@property (nonatomic,retain) UILabel     *setLbl;
@property (nonatomic,retain) UIImageView *loginOutImg;
@property (nonatomic,retain) UILabel     *loginOutLbl;

@end
@implementation MenuFootView
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self _initUI];
    }
    return self;
}
-(void)_initUI{
    _setImg                 = [[UIImageView alloc] initWithFrame:CGRectMake(0, (FOOTHEIGHT - MENUFOOTIMAGEWIDTH)/2.0, MENUFOOTIMAGEWIDTH, MENUFOOTIMAGEWIDTH)];
    _setImg.contentMode     = UIViewContentModeScaleAspectFit;
    _setImg.backgroundColor = [UIColor clearColor];
    [_setImg setImage: [UIImage imageNamed:@"set"] ];
    [self addSubview:_setImg];
    
    _setLbl                 = [[UILabel alloc] initWithFrame:CGRectMake(FOOTWIDTH / 6.0, 0, FOOTWIDTH / 3.0, FOOTHEIGHT)];
    _setLbl.text            = @"设置";
    _setLbl.textColor       = [UIColor whiteColor];
    _setLbl.font            = [UIFont fontWithName:@"Helvetica-BoldOblique" size:14];
    _setLbl.textAlignment   = _TEXT_ALIGN_CENTER;
    [self addSubview:_setLbl];
    
    _loginOutImg                 = [[UIImageView alloc] initWithFrame:CGRectMake(FOOTWIDTH / 2.0, (FOOTHEIGHT - MENUFOOTIMAGEWIDTH)/2.0, MENUFOOTIMAGEWIDTH, MENUFOOTIMAGEWIDTH)];
    _loginOutImg.contentMode     = UIViewContentModeScaleAspectFit;
    _loginOutImg.backgroundColor = [UIColor clearColor];
    _loginOutImg.image           = [UIImage imageNamed:@"loginout"];
    [self addSubview:_loginOutImg];
    
    _loginOutLbl                 = [[UILabel alloc] initWithFrame:CGRectMake(FOOTWIDTH / 3.0 * 2.0, 0, FOOTWIDTH / 3.0, FOOTHEIGHT)];
    _loginOutLbl.text            = @"注销";
    _loginOutLbl.textColor       = [UIColor whiteColor];
    _loginOutLbl.font            = [UIFont fontWithName:@"Helvetica-BoldOblique" size:14];
    _loginOutLbl.textAlignment   = _TEXT_ALIGN_CENTER;
    [self addSubview:_loginOutLbl];
    
    UIButton *setBtn        = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, FOOTWIDTH / 2.0, FOOTHEIGHT)];
    setBtn.backgroundColor  = [UIColor clearColor];
    [setBtn addTarget:self action:@selector(setClickAction) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:setBtn];
    [self bringSubviewToFront:setBtn];
    
    UIButton *loginOutBtn        = [[UIButton alloc] initWithFrame:CGRectMake(FOOTWIDTH / 2.0, 0, FOOTWIDTH / 2.0, FOOTHEIGHT)];
    loginOutBtn.backgroundColor  = [UIColor clearColor];
    [loginOutBtn addTarget:self action:@selector(loginOutAction) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:loginOutBtn];
    [self bringSubviewToFront:loginOutBtn];
}
-(void)setClickAction{
    if (self.menuFootdelegate) {
        [self.menuFootdelegate menuFootClickSet];
    }
}

-(void)loginOutAction{
    if (self.menuFootdelegate) {
        [self.menuFootdelegate menuFootClickLoginOut];
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
